<template>
  <div>
    <a-locale-provider :locale="localItem">
      <nuxt/>
    </a-locale-provider>
  </div>
</template>

<script lang='ts'>
import { Component, Vue } from "vue-property-decorator";
import { Getter, namespace } from "vuex-class";
import zhCN from "ant-design-vue/lib/locale-provider/zh_CN";
import en_GB from "ant-design-vue/lib/locale-provider/en_GB";

const someModule = namespace("i18n");
@Component({
  name: "Other",
})
export default class Default extends Vue {
  @someModule.Getter("get") getGetters;
  @someModule.Mutation("add") setAdd;

  Formatter(value: Object): Object {
    let local = this.getGetters.value;
    switch (local) {
      case "zhCN":
        local = zhCN;
        break;
      case "en_GB":
        local = en_GB;
        break;
    }
    return local;
  }
  get localItem(): Object {
    const local = this.Formatter(this.getGetters.value);
    return local;
  }
}
</script>
